//
// Created by hamlet on 2021/12/29.
//

#ifndef TIANQI_MAINWINDOW_H
#define TIANQI_MAINWINDOW_H

#include <QWidget>
#include "tianqidata.h"

class TianqiAccesser;

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
class QGraphicsSvgItem;
class QToolButton;
QT_END_NAMESPACE

class MainWindow : public QWidget {
Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    void injectTianqiAccesser(TianqiAccesser *accesser);
    ~MainWindow() override;
    void updatePage(const TianqiData &data);

    [[nodiscard]] const QToolButton *get_toolButton_refresh() const;
    [[nodiscard]] const QToolButton *get_toolButton_settings() const;

public slots:
    void showPageMain();
    void showPageSettings();

protected:
    void closeEvent(QCloseEvent *event) override;
    bool eventFilter(QObject *object, QEvent *event) override;

private:
    Ui::MainWindow *ui;
    QGraphicsSvgItem *m_svgItem;
};

#endif //TIANQI_MAINWINDOW_H
